<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\DB;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateMessagesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('messages', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->integer('user_id')->comment('用户id');
            $table->string('phone')->default('')->comment('用户手机号');
            $table->string('nickname')->default('')->comment('用户昵称');
            $table->text('content')->comment('留言内容');
            $table->text('reply')->nullable()->comment('回复内容');
            $table->integer('status')->default(1)->comment('状态1未回复2已回复');
            $table->timestamps();
        });
        DB::statement("ALTER TABLE `messages` comment '用户留言表';");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('messages');
    }
}
